<template>
    <div>
        <van-nav-bar
                title="系统日志"
                fixed
        />
        <van-list
                :finished="true"
                v-model:loading="loading"
                finished-text="没有更多了"
                style="margin-top: 50px"
        >
            <van-cell v-for="item in list" :key="item.id">
                <template #title>
                    <span style="color:#888;font-style: italic">{{ item.createdAt }}</span>
                    <span style="font-weight: 600;padding-left: 10px">{{ item.desc }}</span>
                </template>
            </van-cell>
        </van-list>
    </div>
</template>

<script setup>
import {onMounted, ref} from 'vue'
import {getLogs} from '@/api'
import dayjs from "dayjs";

const list = ref([]);
const loading = ref(false);


onMounted(() => {
    getLogs().then(res => {
        loading.value = false
        list.value = res.data.map(item=>{
            return {
                createdAt:dayjs(item.createdAt).format('YYYY-MM-DD HH:mm:ss'),
                desc:item.desc
            }
        })
    })
})
</script>

<style scoped>

</style>